package study.itheima.dao;

import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import study.itheima.domain.Items;
import study.itheima.domain.Orders;

import java.util.List;

public interface OrdersMap {
    @Select("select * from orders where user_id=${id}")
    @Results(id="OrdersMap",value ={
//            @Result(column = "user_id",property = "user_id"),
            @Result(id=true,column = "id",property = "id"),
            @Result(column = "number",property = "number"),
            @Result(property = "itemsListlist",javaType = List.class,column = "id",many = @Many(select = "study.itheima.dao.ItemsMap.findByOid"))
    }

    )
    List<Orders> findById();
}
